from rest_framework import serializers
from django.contrib.auth import get_user_model
from django.utils import timezone


class UserInformationSerializers(serializers.ModelSerializer):
    last_login_time = serializers.DateTimeField(source='last_login', format='%Y-%m-%d %H:%M:%S')
    register_time = serializers.DateTimeField(source='create_time', format='%Y-%m-%d %H:%M:%S')

    class Meta:
        model = get_user_model()
        fields = ['username', 'last_login_time', 'is_superuser', 'email', 'register_time']

